home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6301 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: isonews.bbn.hp.com!hpbblb!news
  2. From: Matthias Dittrich <matti>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is it possible to have one Makefile for several compilers?
  5. Date: 21 Feb 1996 14:10:44 GMT
  6. Organization: Hewlett-Packard Co.
  7. Message-ID: <4gf954$ad@hpbblb.bbn.hp.com>
  8. References: <31249363.1664@ivab.se>
  9. NNTP-Posting-Host: trabant.bbn.hp.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
  14. X-URL: news:31249363.1664@ivab.se
  15.  
  16. Goran Wireen <Goran_Wireen@ivab.se> wrote:
  17. >I would like to use the same Makefile for different compilers 
  18. >(Gnu C/C++, Unix cc, CXX). I was hoping that I easily could 
  19. >select compiler by calling e.g:
  20. >
  21. >  make gcc all
  22. >
  23. >and by using a Makefile that looks something like this:
  24. >
  25. >  # Default compiler is cc
  26. >  CC = cc
  27. >
  28. >  cxx:
  29. >    CC = cxx
  30. >
  31. >  gcc:
  32. >    CC = gcc
  33. >
  34. >  all:
  35. >    $(CC) $(CFLAGS_AND_STUFF) $(SOURCES) ...
  36. >...
  37. Delete the targets cxx: and gcc: from your makefile, then you can call
  38. it with:
  39. make CC=gcc all
  40.  
  41. Good luck,
  42. Matthias
  43.  
  44.